package com.gdziarmaga.webshop.login.services;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.gdziarmaga.webshop.login.model.Login;
import com.gdziarmaga.webshop.login.model.LoginDAO;
import com.gdziarmaga.webshop.review.model.Review;
import com.gdziarmaga.webshop.review.model.ReviewDAO;

@Service("loginManager")
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public class LoginManagerImpl implements LoginManager {

	@Autowired
	private LoginDAO loginDAO;

	@Override
	public Login getLoginById(Long loginId) {
		return loginDAO.getById(loginId);
	}

	@Override
	public Login getLoginByLogin_date(Date login_date) {
		return loginDAO.findProductByLogin_date(login_date);
	}

//	@Override
//	public Login getLoginByComputer_ip(String computer_ip) {
//		return loginDAO.findProductByComputer_ip(computer_ip);
//	}

	@Override
	public void saveLogin(Login login) {
		loginDAO.save(login);
	}

}
